package com.web.dao;

import com.web.entity.UserSupply;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.*;

public interface UserSupplyMapper {
    @Delete({
        "delete from APP_USER_SUPPLY",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into APP_USER_SUPPLY (user_id, supply_class_id, ",
        "tech_name, realname, ",
        "id_card, id_card_z, ",
        "id_card_f, tech_card, ",
        "logo, tech_create_time, ",
        "tech_city, tech_mobile, ",
        "tech_business, tech_skill, ",
        "create_time, modify_time, ",
        "auth_status)",
        "values (#{userId,jdbcType=VARCHAR}, #{supplyClassId,jdbcType=VARCHAR}, ",
        "#{techName,jdbcType=VARCHAR}, #{realname,jdbcType=VARCHAR}, ",
        "#{idCard,jdbcType=VARCHAR}, #{idCardZ,jdbcType=VARCHAR}, ",
        "#{idCardF,jdbcType=VARCHAR}, #{techCard,jdbcType=VARCHAR}, ",
        "#{logo,jdbcType=VARCHAR}, #{techCreateTime,jdbcType=TIMESTAMP}, ",
        "#{techCity,jdbcType=VARCHAR}, #{techMobile,jdbcType=VARCHAR}, ",
        "#{techBusiness,jdbcType=VARCHAR}, #{techSkill,jdbcType=VARCHAR}, ",
        "#{createTime,jdbcType=TIMESTAMP}, #{modifyTime,jdbcType=TIMESTAMP}, ",
        "#{authStatus,jdbcType=INTEGER})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(UserSupply record);

    int insertSelective(UserSupply record);

    @Select({
        "select",
        "id, user_id, supply_class_id, tech_name, realname, id_card, id_card_z, id_card_f, ",
        "tech_card, logo, tech_create_time, tech_city, tech_mobile, tech_business, tech_skill, ",
        "create_time, modify_time, auth_status",
        "from APP_USER_SUPPLY",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    UserSupply selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(UserSupply record);

    @Update({
        "update APP_USER_SUPPLY",
        "set user_id = #{userId,jdbcType=VARCHAR},",
          "supply_class_id = #{supplyClassId,jdbcType=VARCHAR},",
          "tech_name = #{techName,jdbcType=VARCHAR},",
          "realname = #{realname,jdbcType=VARCHAR},",
          "id_card = #{idCard,jdbcType=VARCHAR},",
          "id_card_z = #{idCardZ,jdbcType=VARCHAR},",
          "id_card_f = #{idCardF,jdbcType=VARCHAR},",
          "tech_card = #{techCard,jdbcType=VARCHAR},",
          "logo = #{logo,jdbcType=VARCHAR},",
          "tech_create_time = #{techCreateTime,jdbcType=TIMESTAMP},",
          "tech_city = #{techCity,jdbcType=VARCHAR},",
          "tech_mobile = #{techMobile,jdbcType=VARCHAR},",
          "tech_business = #{techBusiness,jdbcType=VARCHAR},",
          "tech_skill = #{techSkill,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "modify_time = #{modifyTime,jdbcType=TIMESTAMP},",
          "auth_status = #{authStatus,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(UserSupply record);

    UserSupply findUserSupply(@Param("key") String key, @Param("value") String value);
}